package process

import (
	"encoding/json"
	"go_code/chatroom/client/message"
	"go_code/chatroom/client/utils"
)

type SmsProcess struct {

}

func (sp *SmsProcess) SendGroupMessage(content string) {
	var smsMsg *message.SmsMessage
	var msg *message.Message

	smsMsg = &message.SmsMessage{
		UserId: currentUser.UserId,
		Status: currentUser.Status,
		Content: content,
	}

	marshal, err := json.Marshal(smsMsg)
	if err != nil {
		return 
	}

	msg = &message.Message{
		Type: message.TypeSmsReq,
		Data: string(marshal),
	}

	t := &utils.Transport{
		Conn: currentUser.Conn,
	}
	_ = t.WritePkg(msg)
}
